Repository navigation
Conversation
Define SND_AUDIOCODEC_APTX_HD (0x15), SND_AUDIOCODEC_G726 (0x16), SND_AUDIOCODEC_ALAW (0x17), and SND_AUDIOCODEC_MULAW (0x18) in compress_params.h and advance SND_AUDIOCODEC_MAX. Advertise playback/capture support for the new codecs in base_fw.c get_codec_info() with bounds-checked helper add_codec_info_item(), and extend the BESPOKE capability guards to cover them. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Extend ffmpeg_dec and ffmpeg_enc with three pure-integer audio codecs: - Bluetooth aptX HD (24-bit S32P, 6-byte block-aligned decode and encode) - ITU-T G.726 ADPCM (big-endian profile=0 and little-endian profile=1, 2/3/4/5 bits/sample at 8/16/48 kHz with FF_COMPLIANCE_UNOFFICIAL) - ITU-T G.711 A-law and mu-law companded PCM (mono/stereo at 8/16/48 kHz) Also extract decim_3to1_step(), add an anti-aliased 6:1 (48->8 kHz) mono decimator in ffmpeg_dec-convert.c, and replace hardcoded G.722/SBC rate and channel conversion checks in ffmpeg-encode.c with per-codec supports_mono_downmix, supports_decim_3to1, and supports_decim_6to1 flags. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lgirdwood
force-pushed
the
topic/ffmpeg-tier1
branch
from
November 15, 2026 16:06
505ec0c to
a710769
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
G.726 encoding and decoding accept unsupported multichannel requests as mono, while the 16→8 kHz decimation filter provides insufficient stopband rejection and introduces audible-band aliasing.
3 open issues
What changed in this PR
Extends SOF’s FFmpeg-based compressed playback and capture with aptX HD, G.726/G.726LE, and G.711, building on the lossless codec support in #11427.
Changes:
- Adds codec implementations, format selection, and packet framing.
- Adds 48→8 kHz mono decimation and encoder conversion capability flags.
- Integrates the codecs into configuration, builds, and IPC capability reporting.
| File | Description |
|---|---|
src/kernel/audio/base_fw.c |
Advertises new codec capabilities using bounded insertion. |
src/include/ipc/compress_params.h |
Defines new compressed-audio codec IDs. |
src/audio/ffmpeg_dec/llext/CMakeLists.txt |
Includes new codecs in loadable-module builds. |
src/audio/ffmpeg_dec/Kconfig |
Adds decoder and encoder selection options. |
src/audio/ffmpeg_dec/ffmpeg.cmake |
Enables selected codecs in libavcodec. |
src/audio/ffmpeg_dec/ffmpeg-encode.c |
Registers encoders and uses conversion capability flags. |
src/audio/ffmpeg_dec/ffmpeg-enc-sbc.c |
Declares SBC conversion capabilities. |
src/audio/ffmpeg_dec/ffmpeg-enc-g726.c |
Implements G.726/G.726LE encoding. |
src/audio/ffmpeg_dec/ffmpeg-enc-g722.c |
Declares G.722 conversion capabilities. |
src/audio/ffmpeg_dec/ffmpeg-enc-g711.c |
Implements shared A-law and mu-law encoding. |
src/audio/ffmpeg_dec/ffmpeg-enc-aptx.c |
Shares encoder logic with aptX HD. |
src/audio/ffmpeg_dec/ffmpeg_dec.h |
Adds codec definitions, request fields, and conversion state. |
src/audio/ffmpeg_dec/ffmpeg_dec.c |
Registers decoders and stores IPC stream parameters. |
src/audio/ffmpeg_dec/ffmpeg_dec-g726.c |
Configures G.726 decoding and aligned packet limits. |
src/audio/ffmpeg_dec/ffmpeg_dec-g711.c |
Configures G.711 decoding and channel-aligned packets. |
src/audio/ffmpeg_dec/ffmpeg_dec-ffmpeg.c |
Maps new codecs and G.726 profiles to libavcodec. |
src/audio/ffmpeg_dec/ffmpeg_dec-convert.h |
Declares the 6:1 mono decimator. |
src/audio/ffmpeg_dec/ffmpeg_dec-convert.c |
Extracts the 3:1 filter step and adds 6:1 decimation. |
src/audio/ffmpeg_dec/ffmpeg_dec-aptx.c |
Adds aptX HD selection and six-byte block alignment. |
src/audio/ffmpeg_dec/CMakeLists.txt |
Includes new codecs in built-in builds. |
Review effort: Balanced
| g726->enc_rate = enc_rate; | ||
| g726->avctx->strict_std_compliance = FF_COMPLIANCE_UNOFFICIAL; | ||
| g726->avctx->sample_rate = enc_rate; | ||
| av_channel_layout_default(&g726->avctx->ch_layout, 1); |
Comment on lines
+515
to
+517
| int32_t acc = (int32_t)hist[12] + 2 * (int32_t)y0 + (int32_t)y1 + 2; | ||
|
|
||
| dst[i] = sat_int16(acc >> 2); |
| } | ||
|
|
||
| avctx->sample_rate = rate; | ||
| av_channel_layout_default(&avctx->ch_layout, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Extends
ffmpeg_decandffmpeg_encwith three pure-integer, streaming audio codecs alongside IPC capability advertisement and a 6:1 mono decimator:CONFIG_FFMPEG_DEC_APTX_HD,CONFIG_FFMPEG_ENC_APTX_HD,SND_AUDIOCODEC_APTX_HD = 0x15):ffmpeg_dec-aptx.candffmpeg-enc-aptx.cto share core logic between aptX and aptX HD (AV_SAMPLE_FMT_S32Pstereo, 6-byte block alignment clamped at1020bytes per unparsed packet).CONFIG_FFMPEG_DEC_G726,CONFIG_FFMPEG_ENC_G726,SND_AUDIOCODEC_G726 = 0x16):profile=0,adpcm_g726) and little-endian (profile=1,adpcm_g726le), 2/3/4/5 bits per sample (default4), byte/block-aligned unparsed framing (1/3/5bytes),FF_COMPLIANCE_UNOFFICIALfor 8/16/48 kHz streams, and160-sample encode framing.CONFIG_FFMPEG_DEC_ALAW/MULAW,CONFIG_FFMPEG_ENC_ALAW/MULAW,SND_AUDIOCODEC_ALAW = 0x17,SND_AUDIOCODEC_MULAW = 0x18):ffmpeg_dec-g711.candffmpeg-enc-g711.ccovering mono and stereo streams at 8/16/48 kHz.decim_3to1_step()and addedffmpeg_dec_pcm_decimate_6to1_s16_mono()(48 kHz -> 8 kHz) inffmpeg_dec-convert.c.ffmpeg-encode.cwithsupports_mono_downmix,supports_decim_3to1, andsupports_decim_6to1onstruct ffmpeg_enc_codec_ops.Commits
9b1a1f67aipc: compress: add aptX HD, ITU-T G.726, and ITU-T G.711 codec IDsa710769cdffmpeg_dec: add aptX HD, G.726/G.726LE, and G.711 A-law/mu-law codecsTesting
zephyr/scripts/checkpatch.pl --no-tree -g origin/main..HEAD --ignore C99_COMMENTS(with Zephyr.checkpatch.conf) — 0 errors, 0 warnings for both9b1a1f67a510anda710769cd2c9.intel_adsp/ace30/ptl,CONFIG_COMP_FFMPEG_DEC_STUB=y): passed.intel_adsp/cavs25) and PTL (intel_adsp/ace30/ptl) with all Tier 1 codecs enabled +west sign: passed.FAIL=0across 5 capture + playback pairs):aptx_hd_48k_2c(id=21, 48000 Hz 2 ch): capture decoded withffmpeg/ffprobe(pcm_s16le,48000,2) and playback verified.g726_8k_32k(id=22, 8000 Hz 1 chprof=0) andg726le_8k_24k(id=22, 8000 Hz 1 chprof=1): capture decoded (pcm_s16le,8000,1) and playback verified.alaw_8k_1c(id=23, 8000 Hz 1 ch) andmulaw_8k_1c(id=24, 8000 Hz 1 ch): capture decoded (pcm_s16le,8000,1) and playback verified.505ec0c1e, identical codec code): 13 capture + playback configurations (FAIL=0), additionally covering G.726 at 16/40 kbps (8k),64k(16k, 3:1 decimator), and192k(48k), plus A-law/mu-law at16kmono and48kstereo.